#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;
class Date
{
public:
    Date(int year)
        :_year(year)
    {}
    int GetMonthDay(int year, int month)
    {
        static int Month[] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
        if (month == 2 && (!(year % 400) || (year % 100 != 0 && !(year % 4))))
        {
            return 29;
        }
        else
            return Month[month];
    }
    Date& operator+=(int day);
    void Print();
private:
    int _year;
    int _month = 0;
    int _day = 0;
};
Date& Date::operator+=(int day)
{
    _day += day;
    while (_day > GetMonthDay(_year, _month))
    {
        _day -= GetMonthDay(_year, _month);
        _month++;
        if (_month == 13)
        {
            _year++;
            _month = 1;
        }
    }
    return *this;
}
void Date::Print()
{
    cout << _year << '-';
    if (_month < 10)
        cout << '0' << _month << '-';
    else
        cout << _month << '-';
    if (_day < 10)
        cout << '0' << _day;
    else
        cout << _day;
}
int main() {
    int year, day;
    while (~scanf("%d%d", &year, &day))
    {
        Date a(year);
        a += day - 1;
        a.Print();
        cout << endl;
    }


}
